Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Calculating Distances Between Points

QuickDraw 3D provides routines that you can use to determine the distance between two points. QuickDraw 3D also provides routines that you can use to determine the square of the distance between two points. These distance-squared routines are much faster than the simple distance routines and are therefore recommended for situations in which only relative distances are important to you.

Q3Point2D_Distance

You can use the Q3Point2D_Distance function to determine the distance between two two-dimensional points.

float Q3Point2D_Distance (
                     const TQ3Point2D *p1,
                     const TQ3Point2D *p2);
p1
A two-dimensional point.
p2
A two-dimensional point.

DESCRIPTION

The Q3Point2D_Distance function returns, as its function result, the absolute value of the distance between points p1 and p2 .

Q3Param2D_Distance

You can use the Q3Param2D_Distance function to determine the distance between two two-dimensional parametric points.

float Q3Param2D_Distance (
                     const TQ3Param2D *p1,
                     const TQ3Param2D *p2);
p1
A two-dimensional parametric point.
p2
A two-dimensional parametric point.

DESCRIPTION

The Q3Param2D_Distance function returns, as its function result, the absolute value of the distance between parametric points p1 and p2 .

Q3Point3D_Distance

You can use the Q3Point3D_Distance function to determine the distance between two three-dimensional points.

float Q3Point3D_Distance (
                     const TQ3Point3D *p1,
                     const TQ3Point3D *p2);
p1
A three-dimensional point.
p2
A three-dimensional point.

DESCRIPTION

The Q3Point3D_Distance function returns, as its function result, the absolute value of the distance between points p1 and p2 .

Q3RationalPoint3D_Distance

You can use the Q3RationalPoint3D_Distance function to determine the distance between two three-dimensional rational points.

float Q3RationalPoint3D_Distance (
                     const TQ3RationalPoint3D *p1,
                     const TQ3RationalPoint3D *p2);
p1
A rational three-dimensional point.
p2
A rational three-dimensional point.

DESCRIPTION

The Q3RationalPoint3D_Distance function returns, as its function result, the absolute value of the distance between points p1 and p2 . The distance returned is a two-dimensional distance.

Q3RationalPoint4D_Distance

You can use the Q3RationalPoint4D_Distance function to determine the distance between two four-dimensional rational points.

float Q3RationalPoint4D_Distance (
                     const TQ3RationalPoint4D *p1,
                     const TQ3RationalPoint4D *p2);
p1
A rational four-dimensional point.
p2
A rational four-dimensional point.

DESCRIPTION

The Q3RationalPoint4D_Distance function returns, as its function result, the absolute value of the distance between points p1 and p2 . The distance returned is a three-dimensional distance.

Q3Point2D_DistanceSquared

You can use the Q3Point2D_DistanceSquared function to determine the square of the distance between two two-dimensional points.

float Q3Point2D_DistanceSquared (
                     const TQ3Point2D *p1,
                     const TQ3Point2D *p2);
p1
A two-dimensional point.
p2
A two-dimensional point.

DESCRIPTION

The Q3Point2D_DistanceSquared function returns, as its function result, the square of the distance between points p1 and p2 .

Q3Param2D_DistanceSquared

You can use the Q3Param2D_DistanceSquared function to determine the square of the distance between two two-dimensional parametric points.

float Q3Param2D_DistanceSquared (
                     const TQ3Param2D *p1,
                     const TQ3Param2D *p2);
p1
A two-dimensional parametric point.
p2
A two-dimensional parametric point.

DESCRIPTION

The Q3Param2D_DistanceSquared function returns, as its function result, the square of the distance between parametric points p1 and p2 .

Q3Point3D_DistanceSquared

You can use the Q3Point3D_DistanceSquared function to determine the square of the distance between two three-dimensional points.

float Q3Point3D_DistanceSquared (
                     const TQ3Point3D *p1,
                     const TQ3Point3D *p2);
p1
A three-dimensional point.
p2
A three-dimensional point.

DESCRIPTION

The Q3Point3D_DistanceSquared function returns, as its function result, the square of the distance between points p1 and p2 .

Q3RationalPoint3D_DistanceSquared

You can use the Q3RationalPoint3D_DistanceSquared function to determine the square of the distance between two rational three-dimensional points.

float Q3RationalPoint3D_DistanceSquared (
                     const TQ3RationalPoint3D *p1,
                     const TQ3RationalPoint3D *p2);
p1
A rational three-dimensional point.
p2
A rational three-dimensional point.

DESCRIPTION

The Q3RationalPoint3D_DistanceSquared function returns, as its function result, the square of the distance between points p1 and p2 . The distance returned is a two-dimensional distance.

Q3RationalPoint4D_DistanceSquared

You can use the Q3RationalPoint4D_DistanceSquared function to determine the square of the distance between two rational four-dimensional points.

float Q3RationalPoint4D_DistanceSquared (
                     const TQ3RationalPoint4D *p1,
                     const TQ3RationalPoint4D *p2);
p1
A rational four-dimensional point.
p2
A rational four-dimensional point.

DESCRIPTION

The Q3RationalPoint4D_DistanceSquared function returns, as its function result, the square of the distance between points p1 and p2 . The distance returned is a three-dimensional distance.


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |